home *** CD-ROM | disk | FTP | other *** search
- Path: fido.asd.sgi.com!austern
- From: Michael Klobe <mklobe@objectspace.com>
- Newsgroups: comp.std.c++
- Subject: stack template argument question
- Date: 03 Apr 1996 16:48:06 PST
- Organization: -
- Approved: austern@isolde.mti.sgi.com
- Message-ID: <pgpmoose.199604031648.8414@isolde.mti.sgi.com>
- NNTP-Posting-Host: isolde.mti.sgi.com
- X-Original-Date: Wed, 3 Apr 96 18:47:43 CST
- X-Auth: PGPMoose V1.1 PGP comp.std.c++
- iQBVAwUBMWMcR0y4NqrwXLNJAQHg1AH/X2pTywwAE2juMfpIUQSot7fTOidvweO0
- E3vld2hwZyjXnp54k5nDi7HLM++SgYoQOXxuZfkfiNpz7xVyBqcLgQ==
- =dEGT
- Originator: austern@isolde.mti.sgi.com
-
- The definition of stack as I understand it is this:
-
- namespace std
- {
- template
- <
- class T,
- class Container = deque< T >,
- class Allocator = allocator
- >
- class stack;
- }
-
- Given this, for what is the Allocator parameter used? It won't be a
- part of the Container type, and stack itself doesn't make any use of
- Allocators. The other sequence adapters (adaptors?) have the same
- semantics. It seems like what you would really want is something
- like this:
-
- namespace std
- {
- template
- <
- class T,
- class Allocator = allocator,
- class Container = deque< T, Allocator >
- >
- class stack;
- }
-
- or even:
-
- namespace std
- {
- template
- <
- class T,
- class Container = deque< T >
- >
- class stack
- {
- public:
- // ... lots of definitions
- typedef Container::allocator_type allocator_type;
- };
- }
-
- What am I missing?
-
- -mck
- _
- _| ~~. Michael Klobe
- \, _} mklobe@objectspace.com
- \( Texas Fight!
- ---
- [ comp.std.c++ is moderated. To submit articles: Try just posting with your
- newsreader. If that fails, use mailto:std-c++@ncar.ucar.edu
- comp.std.c++ FAQ: http://reality.sgi.com/austern/std-c++/faq.html
- Moderation policy: http://reality.sgi.com/austern/std-c++/policy.html
- Comments? mailto:std-c++-request@ncar.ucar.edu
- ]
-